<%@page import="helpers.LanguageHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="entities.User"%>
<%
User user = (User) request.getAttribute("user");
TreeMap check = (TreeMap) request.getAttribute("check");
String success = (String) request.getAttribute("success");
%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/user/layouts/header.jsp" />
<script type="text/javascript">
jQuery(document).ready(function () {
	jQuery("#profileTab li:eq(0)").addClass("active");
});
</script>
                    <!-- change profile
					================================================== -->
                    <div class="tab-pane active" id="profile">
                    	<% if (success != null) { %>
			            <div class="alert alert-success"><%=success %></div>
			            <% } %>
                    
                        <form method="post" action="" class="form-horizontal form-actions">                        	
                            <div class="row-fluid">
                            	<div class="span7">
                                
                                	<!-- name & Gender
                                    ================================================== -->
                                    <div class="row-fluid">
                                        <div class="span8 control-group <%=check.get("name") != null ? "error" : ""%>">
                                            <label><i class="icon-eye-open"></i> Display Name</label>
	                                            <input type="text" id="inputName" name="name" placeholder="Name" value="<%=user.getName() %>" class="input-block-level">
												<% if (check.get("name") != null) { %>
												<br />
					                            <span class="help-inline"><%=check.get("name") %></span>
					                            <% } %>
                                        </div>
                                        <div class="span4 control-group <%=check.get("gender") != null ? "error" : ""%>">
                                        	<label><i class="icon-user"></i> Gender</label>
                                            <select name="gender" id="inputGender" class="input-block-level">
					                        	<option value="0" <%=user.getGender() == 0 ? "selected=\"selected\"" : ""%>>Male</option>
					                        	<option value="1" <%=user.getGender() == 1 ? "selected=\"selected\"" : ""%>>Female</option>
					                        </select>
					                        <% if (check.get("gender") != null) { %>
					                        <br />
				                            <span class="help-inline"><%=check.get("gender") %></span>
				                            <% } %>
                                        </div>
                                    </div>
                                    
                                    <!-- email address
                                    ================================================== -->
                                    <div class="control-group <%=check.get("email") != null ? "error" : ""%>">
                                        <label><i class="icon-envelope"></i> Email address</label>
                                        <input type="text" id="inputEmail" name="email" placeholder="Email address" value="<%=user.getUsername() %>" class="input-block-level">
										<% if (check.get("email") != null) { %>
										<br />
			                            <span class="help-inline"><%=check.get("email") %></span>
			                            <% } %>
                                        
                                    </div>
                                    
                                    <!-- website
                                    ================================================== -->
                                    <div class="control-group <%=check.get("website") != null ? "error" : ""%>">
                                        <label><i class="icon-globe"></i> website url</label>
                                        <input type="text" id="inputWebsite" name="website" placeholder="Website url" value="<%=user.getWebsite()%>"  class="input-block-level">
										<% if (check.get("website") != null) { %>
			                            <span class="help-inline"><%=check.get("website") %></span>
			                            <% } %>             
                                    </div>
                                    
                                    <!-- submit button
                                    ================================================== -->
                                    <button type="submit" class="btn btn-primary">Change my profile</button>
                                </div>
                                <div class="span5">
                                
                                	<!-- About me
                                    ================================================== -->
                                    <div class="control-group">
                                        <label><i class="icon-comment"></i> About me</label>
                                        <textarea rows="8" id="inputAboutme" name="aboutme" placeholder="About Me" class="input-block-level"><%=user.getAboutme() %></textarea>
										<% if (check.get("aboutme") != null) { %>
			                            <span class="help-inline"><%=check.get("aboutme") %></span>
			                            <% } %>                     
                                    </div>                                    
                                </div>
                            </div>
                        </form>
                    </div>
                    
                    
<jsp:include page="/user/layouts/footer.jsp" />